package com.zzz.springcloud.controller;

import com.zzz.springcloud.service.PaymentService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class PaymentController {

    @Resource
    PaymentService paymentService;

    @GetMapping("/payment/hystrix/ok")
    public String getPaymentOK() {
        return paymentService.paymentInfoOk();
    }

    @GetMapping("/payment/hystrix/timeout")
    public String getPaymentTimeOut() {
        return paymentService.paymentInfoTimeOut();
    }

    @GetMapping("/payment/hystrix/circuitBreader/{id}")
    public String paymentCircuitBreaker(@PathVariable("id") Long id) {
        return paymentService.paymentCircuitBreaker(id);
    }
}
